<html>
<head>
	<title>Excersise 9</title>
	<link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
	<div id="js-console"></div>
	<script src="scripts/js-console.js"></script>
	<script>
	var text = "Here are some emails asen.asenov@abv.bg and may be some more mails anreiKirev@gmail.bg ";
	jsConsole.writeLine(text);
	var emailArr = [];
	var index = text.indexOf("@");
	while (index > -1) {
	if (text[index-1]!=" " && text[index+1]!=" ") {
	var identifier = text.substring(text.lastIndexOf(" ", index - 1), index);
	var host = text.substring(index + 1, text.indexOf(".", index + 1));
	var domain = text.substring(text.indexOf(".", index + 1) + 1, text.indexOf(" ", text.indexOf(".", index + 1) + 1));
	var email = identifier + "@" + host + "." + domain;
	emailArr.push(email);
	index = text.indexOf("@",index+1);
	}
	}
	jsConsole.writeLine();
	jsConsole.writeLine("extracted e-mails are: ");
	for (var email in emailArr) {
	jsConsole.writeLine(emailArr[email]);
	}




	</script>
</body>
</html>
